﻿create table TourPackage
(
	 [TourPackageId] int identity(1, 1) primary key
	,[TourPackageName] nvarchar(128)
	,[Tickets] varchar(64)
	,[TicketPrices] decimal
	,[Hotels] varchar(64)
	,[HotelPrices] decimal
	,[Restaurant] varchar(64)
	,[RestaurantPrices] decimal
	,[Visas] varchar(64)
	,[VisaPrices] decimal
	,[Insurance] varchar(64)
	,[InsurancePrices] decimal
	,[TravelGuideCashs] varchar(64)
	,[TravelGuideCashPrices] decimal
	,[Services] varchar(64)
	,[ServicePrices] decimal
	,[TotalPrice] decimal
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
	,[Status] int
)
go

CREATE PROCEDURE TourPackageGet
	@TourPackageId int	
AS
SELECT *
FROM [TourPackage]
WHERE [TourPackage].[TourPackageId] = @TourPackageId
GO

CREATE PROCEDURE TourPackageList
AS
SELECT *
FROM [TourPackage]
ORDER BY TourPackageId DESC
GO

ALTER PROCEDURE TourPackageInsert
	 @TourPackageName nvarchar(128)
	,@Tickets varchar(64)
	,@TicketPrices decimal(18, 0)
	,@Hotels varchar(64)
	,@HotelPrices decimal(18, 0)
	,@Restaurant varchar(64)
	,@RestaurantPrices decimal(18, 0)
	,@Visas varchar(64)
	,@VisaPrices decimal(18, 0)
	,@Insurance varchar(64)
	,@InsurancePrices decimal(18, 0)
	,@TravelGuideCashs varchar(64)
	,@TravelGuideCashPrices decimal(18, 0)
	,@Services varchar(64)
	,@ServicePrices decimal
	,@TotalPrice decimal(18, 0)
	,@CreatedBy int
	,@CreatedDate datetime
	,@UpdatedBy int
	,@UpdatedDate datetime
	,@Status int
AS

INSERT INTO TourPackage (
	 [TourPackageName]
	,[Tickets]
	,[TicketPrices]
	,[Hotels]
	,[HotelPrices]
	,[Restaurant]
	,[RestaurantPrices]
	,[Visas]
	,[VisaPrices]
	,[Insurance]
	,[InsurancePrices]
	,[TravelGuideCashs]
	,[TravelGuideCashPrices]
	,[Services]
	,[ServicePrices]
	,[TotalPrice]
	,[CreatedBy]
	,[CreatedDate]
	,[UpdatedBy]
	,[UpdatedDate]
	,[Status]
	
) VALUES (
	 @TourPackageName
	,@Tickets
	,@TicketPrices
	,@Hotels
	,@HotelPrices
	,@Restaurant
	,@RestaurantPrices
	,@Visas
	,@VisaPrices
	,@Insurance
	,@InsurancePrices
	,@TravelGuideCashs
	,@TravelGuideCashPrices
	,@Services
	,@ServicePrices
	,@TotalPrice
	,@CreatedBy
	,@CreatedDate
	,@UpdatedBy
	,@UpdatedDate
	,@Status
	
)

select SCOPE_IDENTITY()
GO

ALTER PROCEDURE TourPackageUpdate
	@TourPackageId int, 
	@TourPackageName nvarchar(128), 
	@Tickets varchar(64), 
	@TicketPrices decimal(18, 0), 
	@Hotels varchar(64), 
	@HotelPrices decimal(18, 0), 
	@Restaurant varchar(64), 
	@RestaurantPrices decimal(18, 0), 
	@Visas varchar(64), 
	@VisaPrices decimal(18, 0), 
	@Insurance varchar(64), 
	@InsurancePrices decimal(18, 0), 
	@TravelGuideCashs varchar(64), 
	@TravelGuideCashPrices decimal(18, 0), 
	@Services varchar(64),
	@ServicePrices decimal,
	@TotalPrice decimal(18, 0), 
	@CreatedBy int, 
	@CreatedDate datetime, 
	@UpdatedBy int, 
	@UpdatedDate datetime, 
	@Status int 

AS

UPDATE TourPackage SET
	   [TourPackageName] = @TourPackageName
	   ,[Tickets] = @Tickets
	   ,[TicketPrices] = @TicketPrices
	   ,[Hotels] = @Hotels
	   ,[HotelPrices] = @HotelPrices
	   ,[Restaurant] = @Restaurant
	   ,[RestaurantPrices] = @RestaurantPrices
	   ,[Visas] = @Visas
	   ,[VisaPrices] = @VisaPrices
	   ,[Insurance] = @Insurance
	   ,[InsurancePrices] = @InsurancePrices
	   ,[TravelGuideCashs] = @TravelGuideCashs
	   ,[TravelGuideCashPrices] = @TravelGuideCashPrices
	   ,[Services] = @Services
	   ,[ServicePrices] = @ServicePrices
	   ,[TotalPrice] = @TotalPrice
	   ,[CreatedBy] = @CreatedBy
	   ,[CreatedDate] = @CreatedDate
	   ,[UpdatedBy] = @UpdatedBy
	   ,[UpdatedDate] = @UpdatedDate
	   ,[Status] = @Status
WHERE [TourPackage].[TourPackageId] = @TourPackageId
GO

CREATE PROCEDURE TourPackageDelete
	@TourPackageId int
AS
DELETE FROM TourPackage
WHERE [TourPackage].[TourPackageId] = @TourPackageId
GO